class User < ActiveRecord::Base
  has_many :borrow_recs
  has_many :messages

  validates_presence_of :name, :password, :perm
  validates_uniqueness_of :perm

  def self.authenticate(submitted_perm, submitted_pass)
    self.find(:all, :conditions => ["perm = ? and password = ?", submitted_perm, submitted_pass]).first
  end
end
